<%@ include file="/common/include.jsp"%>

<head>
	<link type="text/css" href="../styles/tooltip/jquery.tooltip.css" rel="stylesheet" />
	
	<script src="../scripts/jquery/jquery.js" type="text/javascript"></script>
	<script src="../scripts/tooltip/jquery.tooltip.js" type="text/javascript"></script>
	
	<script type="text/javascript">
		$(document).ready(function(){
			$("#repositories").change(function(event){
				var elemVersionRepository = $("#versionrepository");
				var elemTrackerRepository = $("#trackerrepository");
				var selected = $("#repositories option:selected").text();
				
				if (selected == 'VERSION REPOSITORY'){
					elemVersionRepository.show("slow");
					elemTrackerRepository.hide("slow");
				} else if (selected == 'TRACKER REPOSITORY'){
					elemTrackerRepository.show("slow");
					elemVersionRepository.hide("slow");
				} else {
					elemVersionRepository.hide("slow");
					elemTrackerRepository.hide("slow");
				}
			});
			
			var elemProxyData = $("#proxydata");
			$("#proxy").click(function(event){
				elemProxyData.slideToggle("slow");
			});
		});

		$(function() {
			$("#formLoad *").tooltip({
				track: true,
				delay: 0,
				showURL: false,
				showBody: " - ",
				extraClass: "tip",
				fixPNG: true,
				left: -120
			});
		});
	</script>
	
	<style type="text/css">
		#versionrepository{
			display: none;
		}
		#trackerrepository{
			display: none;
		}
		#proxydata{
			background-color: #F7F7F7;
			border: 1px solid #DDD;
			display: none;
		}
	</style>
</head>

<s:actionerror />
<s:actionmessage />

<h2>Load a New Project</h2>

<s:form namespace="/load" action="load" id="formLoad">

	<tr>
		<td>
			<h3>Project Information</h3>
		</td>
	</tr>

	<s:textfield label="Name" name="project.name" required="true" size="50" title=" - Type the name of project"/>
	
	<s:textarea label="Description" name="project.description" cols="40" rows="3" title=" - Type a short description of functionality of the project" />
	
	<s:select label="Repository" list="repositories" name="repository" value="" headerKey="" headerValue="-- Select a Repository --" id="repositories" />
	
	<tr>
		<td colspan="2">
			<table id="versionrepository">
				<tr>
					<td>
						<h3>Version Repository Information</h3>
					</td>
				</tr>
				
				<s:textfield label="Url" name="versionRepository.url" required="true" size="50" title=" - Type the url of your repository location, for example: http://host_location/svn/project" />

				<s:textfield label="Login" name="versionRepository.login" required="true" title=" - Type the login to authenticate in SVN, if the repository is public type anonymous" />
			
				<s:password label="Password" name="versionRepository.password" required="true" title=" - Type the password to authenticate in SVN, if the repository is public, type anonymous" />
			
				<s:textfield label="Start Date" name="versionRepository.startDateLoad" title=" - Type the date from which you want to load data, the format is yyyy-MM-dd. If you doesn't know the start date, leave the field blank" />
			
				<s:textfield label="Finish Date" name="versionRepository.finishDateLoad" title=" - Type the date until which you want to load data, the format is yyyy-MM-dd. If you doesn't know the finish date, leave the field blank" />
			
				<s:select label="Artifact" list="types" name="versionRepository.type" headerKey="" headerValue="-- Select a Artifact --" title=" - Select the artifact which you want to load data" />
				
			</table>
		</td>
	</tr>
	
	<tr>
		<td colspan="2">
			<table id="trackerrepository">
				<tr>
					<td>
						<h3>BugTracker Repository Information</h3>
					</td>
				</tr>
				
				<s:select label="Distribution" list="distributions" name="trackerRepository.distribution" headerKey="" headerValue="--Select a Distribution Tracker--" required="true"  />
	
				<s:textfield label="Group ID" name="trackerRepository.group" title=" - Type the group_id that contains the URL of the tracker page in Sourceforge, this field is an integer and is only for repositories hosted in Sourceforge.net" />
				
			</table>
		</td>
	</tr>
	
	<tr>
		<td>
			<input type="button" value="Require Proxy" id="proxy" />
	
			<table id="proxydata">
			
				<tr>
					<td>
						Proxy Name:
					</td>
					<td>
						<s:textfield name="proxyName" theme="simple" />
					</td>
				</tr>
				
				<tr>
					<td>
						Proxy Password:						
					</td>
					<td>
						<s:password name="proxyPassword" theme="simple" />
					</td>
				</tr>				
				
			</table>
		</td>
	</tr>

	<s:submit value="Load" />

</s:form>


<h2>Other Projects</h2>

<ul class="links">
	<li>
		<s:url id="url" namespace="/list" action="index" includeParams="none" /> <a href="${url}">View Loaded Projects</a>
	</li>
</ul>